<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('出租房源操作')" />
	<th:block th:include="include :: select2-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>

</head>
<body>
    <div class="main-content">
        <form class="form-horizontal" id="form-renHousing-edit" th:object="${housing}" AUTOCOMPLETE="OFF">
            <input name="housingId"  type="hidden"  th:field="*{housingId}" />
            <h4 class="form-header h4">房源基本信息</h4>
            <div class="row">
            	<div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">小区名称：</label>
                        <div class="col-sm-8">
                            <input name="rentResidentialName" class="form-control" type="text"  th:field="*{rentResidentialName}" />
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">面积(㎡)：</label>
                        <div class="col-sm-8">
                            <input name="measure" class="form-control" type="text"  th:field="*{measure}" />
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">楼层：</label>
                        <div class="col-sm-8">
                            <input name="floor" class="form-control" type="text"  th:field="*{floor}" />
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">装修风格：</label>
                        <div class="col-sm-8">
                            <input name="renovation" class="form-control" type="text"  th:field="*{renovation}" />
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">楼户：</label>
                        <div class="col-sm-8">
                            <input name="louhu" class="form-control" type="text"  th:field="*{louhu}" />
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">朝向：</label>
                        <div class="col-sm-8">
                            <input name="orientation" class="form-control" type="text"  th:field="*{orientation}" />
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">手机号：</label>
                        <div class="col-sm-8">
                            <input name="phone" class="form-control" type="text"  th:field="*{phone}" />
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">租金(元/月)：</label>
                        <div class="col-sm-8">
                            <input name="priceMonth" class="form-control" type="text"  th:field="*{priceMonth}" />
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">室：</label>
                        <div class="col-sm-8">
                            <input name="roomNum" class="form-control" type="text"  th:field="*{roomNum}" />
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">厅：</label>
                        <div class="col-sm-8">
                            <input name="officeNum" class="form-control" type="text"  th:field="*{officeNum}" />
                        </div>
                    </div>
                </div>
            </div>
            <h4 class="form-header h4">图片</h4>

            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <div class="file-loading">
                            <input id="housingFile" type="file" name="housingFile"
                                   multiple="multiple">
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>

    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>

	<th:block th:include="include :: footer" />
	<th:block th:include="include :: select2-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>

    <script th:inline="javascript">

        //房源图片数组
        var HousingImageArray = new Array();

        var prefix = ctx+'housingManage';

        $(function () {
            $('#rentResidentialName').attr("disabled", true);

            var housing = [[${housing}]];
            for (var i = 0; i < housing.imageInfoList.length; i++) {
                HousingImageArray.push(housing.imageInfoList[i].imagePath)
            }

            $("#housingFile").fileinput({
                'theme': 'explorer-fas',
                'uploadUrl': '#',
                overwriteInitial: false,
                initialPreviewAsData: true,
                initialPreview: HousingImageArray
            });

        });


        function submitHandler() {
            if ($.validate.form()) {
                var data = $("#form-renHousing-edit").serializeArray();
                $.operate.saveTab(prefix+"/rentHousingEdit",data);
            }
        }



    </script>
</body>
</html>